package com.im.partchat.adapter.learn;

import android.content.Context;
import android.support.annotation.NonNull;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.im.partchat.R;
import com.im.partchat.adapter.base.XRecyclerViewAdapter;
import com.im.partchat.adapter.base.XViewHolder;
import com.im.partchat.bean.learn.Tab4New;
import com.im.partchat.utils.Navigation;

import java.util.List;

/**
 * Created by flyou on 2017/6/30.
 * VersionCode: 1
 * Desc:
 */

public class NewTab4FragmentAdapter extends XRecyclerViewAdapter<Tab4New> {
    private Context context;
    public NewTab4FragmentAdapter(Context context, @NonNull RecyclerView mRecyclerView, List<Tab4New> dataLists) {
        super(mRecyclerView, dataLists,R.layout.view_learn_tab4_item);
        this.context=context;
    }

    @Override
    protected void bindData(XViewHolder holder, final Tab4New data, int position) {
        if (position==0){
            holder.setVisible(R.id.tv_tag,true);
        }else {
            holder.setVisible(R.id.tv_tag,false);
        }
        holder.setOnClickListener(R.id.iv_play, new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Navigation.navigateVideoDetail(data);
            }
        });
        holder.setImageUrl(context, R.id.cover_image,data.getUrl(),R.drawable.img_rectangle_pic_default);
        holder.setText(R.id.tv_title,data.getTitle());
        holder.setText(R.id.tv_joinNum,"已有"+data.getCommentNo()+"人参与");

    }
}
